<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE language SYSTEM "language.dtd"> -->
<!DOCTYPE language SYSTEM "language.dtd"
[
	<!ENTITY name    "[A-Za-z_:][\w.:_-]*">
	<!ENTITY entref  "&amp;(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
	<!ENTITY parsername  "[\w\-\_\.=\d]+">
]>
<language name="Trefor" version="1.20" kateversion="2.4" section="Sources" extensions="*.trf;" mimetype="text/x-fortran-src" casesensitive="0" author="SeB Franchin Matteo (fnch@libero.it)" license="LGPL">
<!-- by P.Baklanov SeB and Franchin Matteo, fnch@libero.it -->
  <highlighting>

<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
<!-- *                              L I S T S                            *  -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
    <list name="keywords">
      <item> allocate </item>
      <item> break </item>
      <item> call </item>
      <item> _c </item>
      <item> _call </item>
      <item> case </item>
      <item> _case </item>
      <item> _of </item>
      <item> _esac </item>
      <item> common </item>
      <item> contains </item>
      <item> continue </item>
      <item> cycle </item>
      <item> deallocate </item>
      <item> default </item>
      <item> _define </item>
      <item> do </item>
      <item> _do </item>
      <item> _od </item>
      <item> forall </item>
      <item> where </item>
      <item> elsewhere </item>
      <item> elseif </item>
      <item> else </item>
      <item> equivalence </item>
      <item> exit </item>
      <item> external </item>
      <item> for </item>
      <item> _fortran </item>
      <item> go </item>
      <item> goto </item>
      <item> if </item>
      <item> _if </item>
      <item> _else </item>
      <item> _fi </item>
      <item> implicit </item>
      <item> include </item>
      <item> _include </item>
      <item> _includen </item>
      <item> interface </item>
      <item> intrinsic </item>
      <item> namelist </item>
      <item> _label </item>
      <item> none </item>
      <item> nullify </item>
      <item> operator </item>
      <item> assignment </item>
      <item> pause </item>
      <item> procedure </item>
      <item> _proc </item>
      <item> pure </item>
      <item> elemental </item>
      <item> record </item>
      <item> recursive </item>
      <item> _repeat </item>
      <item> result </item>
      <item> return </item>
      <item> _return </item>
      <item> select </item>
      <item> _select </item>
      <item> _end </item>
      <item> _other </item>
      <item> _outcom </item>
      <item> selectcase </item>
      <item> stop </item>
      <item> then </item>
      <item> _then </item>
      <item> _trace </item>
      <item> _trefor </item>
      <item> to </item>
      <item> use </item>
      <item> _until </item>
      <item> only </item>
      <item> entry </item>
      <item> while </item>
      <item> _while </item>
    </list>
    <list name="io_functions">
      <item> access </item>
      <item> backspace </item>
      <item> close </item>
      <item> inquire </item>
      <item> open </item>
      <item> print </item>
      <item> read </item>
      <item> rewind </item>
      <item> write </item>
      <item> format </item>
    </list>
    <!-- Keywords inside read(...), write(...), backspace(...),
          rewind(...), endfile(...), close(...) -->
    <list name="io_keywords">
      <item> unit </item>
      <item> end </item>
      <item> err </item>
      <item> fmt </item>
      <item> iostat </item>
      <item> status </item>
      <item> advance </item>
      <item> size </item>
      <item> eor </item>
    </list>
    <!-- Keywords inside open(...) -->
    <list name="open_keywords">
      <item> unit </item>
      <item> iostat </item>
      <item> err </item>
      <item> file </item>
      <item> status </item>
      <item> access </item>
      <item> form </item>
      <item> recl </item>
      <item> blank </item>
      <item> position </item>
      <item> action </item>
      <item> delim </item>
      <item> pad </item>
    </list>
    <!-- Keywords inside inquire(...) -->
    <list name="inquire_keywords">
      <item> unit </item>
      <item> iostat </item>
      <item> err </item>
      <item> file </item>
      <item> exist </item>
      <item> opened </item>
      <item> number </item>
      <item> named </item>
      <item> name </item>
      <item> access </item>
      <item> sequential </item>
      <item> direct </item>
      <item> form </item>
      <item> formatted </item>
      <item> unformatted </item>
      <item> recl </item>
      <item> nextrec </item>
      <item> blank </item>
      <item> position </item>
      <item> action </item>
      <item> read </item>
      <item> write </item>
      <item> readwrite </item>
      <item> delim </item>
      <item> pad </item>
    </list>
    <list name="types">
      <item> double </item>
      <item> precision </item>
      <item> parameter </item>
      <item> save </item>
      <item> pointer </item>
      <item> public </item>
      <item> private </item>
      <item> target </item>
      <item> allocatable </item>
      <item> optional </item>
      <item> sequence </item>
    </list>

<!-- There are 4 types of intrinsic procedures in Fortran 90:
   1) Elemental procedures (elemental_procs);
   2) Inquiry functions (inquiry_fn);
   3) Transformational functions (transform_fn);
   4) Non elemental subroutines (non_elem_subr);
  Often mathematical functions have one generic form and many specific names!
  If you use the generic form, the compiler will select the right function
  to use depending on the type of the arguments.
  But you can use also the specific names!
  -->

<!-- E L E M E N T A L    P R O C E D U R E S -->
    <list name="elemental_procs">
    <!-- Elemental functions that may convert -->
      <item> abs </item>   <!-- Generic form: abs -->
      <item> cabs </item>  <!-- Specific names for abs -->
      <item> dabs </item>
      <item> iabs </item>
      <item> aimag </item>
      <item> aint </item>  <!-- Generic form: aint -->
      <item> dint </item>  <!-- Specific name for aint -->
      <item> anint </item> <!-- Generic form: anint -->
      <item> dnint </item> <!-- Specific name for anint -->
      <item> ceiling </item>
      <item> cmplx </item>
      <item> dcmplx </item> <!-- (non standard) -->
      <item> dimag </item>  <!-- (non standard) -->
      <item> floor </item>
      <item> nint </item>  <!-- Generic form: nint -->
      <item> idnint </item><!-- Specific name for nint -->
      <item> int </item>   <!-- Generic form: int -->
      <item> idint </item> <!-- Specific names for int -->
      <item> ifix </item>
      <item> real </item>  <!-- Generic form: real -->
      <item> float </item> <!-- Specific names for real -->
      <item> sngl </item>
      <item> dble </item>
      <item> dreal </item> <!-- (non standard) -->
      <item> aprime </item> <!-- 5 functions from fortran.xml -->
      <item> dconjg </item> <!-- I don't know if they really belong to -->
      <item> dfloat </item> <!-- the fortran 90/95 standard! -->
      <item> ddmim </item>
      <item> rand </item>
    <!-- Elemental functions that do not convert -->
      <item> modulo </item>
      <item> conjg </item>
      <item> dprod </item>  <!-- dprod(x, y) is the specific name for x*y -->
      <item> dim </item>    <!-- Generic form: dim -->
      <item> ddim </item>   <!-- Specific names for dim -->
      <item> idim </item>
      <item> max </item>    <!-- Generic form: max -->
      <item> amax0 </item>  <!-- Specific names for max -->
      <item> amax1 </item>
      <item> max0 </item>
      <item> max1 </item>
      <item> dmax1 </item>
      <item> min </item>    <!-- Generic form: min -->
      <item> amin0 </item>  <!-- Specific names for min -->
      <item> amin1 </item>
      <item> min0 </item>
      <item> min1 </item>
      <item> dmin1 </item>
      <item> mod </item>    <!-- Generic form: mod -->
      <item> amod </item>   <!-- Specific names for mod -->
      <item> dmod </item>
      <item> sign </item>   <!-- Generic form: sign -->
      <item> dsign </item>  <!-- Specific names for sign -->
      <item> isign </item>
    <!-- Elemental mathematical functions -->
      <item> acos </item>    <!-- Generic form: acos -->
      <item> dacos </item>   <!-- Specific names for acos -->
      <item> asin </item>    <!-- Generic form: asin -->
      <item> dasin </item>   <!-- Specific names for asin -->
      <item> atan </item>    <!-- Generic form: atan -->
      <item> datan </item>   <!-- Specific names for atan -->
      <item> atan2 </item>   <!-- Generic form: atan2 -->
      <item> datan2 </item>  <!-- Specific names for atan2 -->
      <item> cos </item>     <!-- Generic form: cos -->
      <item> ccos </item>    <!-- Specific names for cos -->
      <item> dcos </item>
      <item> cosh </item>    <!-- Generic form: cosh -->
      <item> dcosh </item>   <!-- Specific names for cosh -->
      <item> exp </item>     <!-- Generic form: exp -->
      <item> cexp </item>    <!-- Specific names for exp -->
      <item> dexp </item>
      <item> log </item>     <!-- Generic form: log -->
      <item> alog </item>    <!-- Specific names for log -->
      <item> dlog </item>
      <item> clog </item>
      <item> log10 </item>   <!-- Generic form: log10 -->
      <item> alog10 </item>  <!-- Specific names for log10 -->
      <item> dlog10 </item>
      <item> sin </item>     <!-- Generic form: sin -->
      <item> csin </item>    <!-- Specific names for sin -->
      <item> dsin </item>
      <item> sinh </item>    <!-- Generic form: sinh -->
      <item> dsinh </item>   <!-- Specific name for sinh -->
      <item> sqrt </item>    <!-- Generic form: sqrt -->
      <item> csqrt </item>   <!-- Specific names for sqrt -->
      <item> dsqrt </item>
      <item> tan </item>     <!-- Generic form: tan -->
      <item> dtan </item>    <!-- Generic form: dtan -->
      <item> tanh </item>    <!-- Generic form: tanh -->
      <item> dtanh </item>   <!-- Specific names for tanh -->
    <!-- Elemental character and logical functions -->
    <!-- Character-integer conversions -->
      <item> achar </item>
      <item> char </item>
      <item> iachar </item>
      <item> ichar </item>
    <!-- Lexical comparison functions -->
      <item> lge </item>
      <item> lgt </item>
      <item> lle </item>
      <item> llt </item>
    <!-- String-handling elemental functions -->
      <item> adjustl </item>
      <item> adjustr </item>
      <item> index </item>
      <item> len_trim </item>
      <item> scan </item>
      <item> verify </item>
    <!-- Logical conversion -->
      <item> logical </item>
    <!-- Elemental functions to manipulate reals -->
      <item> exponent </item>
      <item> fraction </item>
      <item> nearest </item>
      <item> rrspacing </item>
      <item> scale </item>
      <item> set_exponent </item>
      <item> spacing </item>
    <!-- Bit manipulation elemental functions -->
      <item> btest </item>
      <item> iand </item>
      <item> ibclr </item>
      <item> ibits </item>
      <item> ibset </item>
      <item> ieor </item>
      <item> ior </item>
      <item> ishft </item>
      <item> ishftc </item>
      <item> not </item>
    <!-- Bit manipulation elemental subroutine -->
      <item> mvbits </item>
    <!-- Merge elemental function -->
      <item> merge </item>
    </list>

<!-- I N Q U I R Y    F U N C T I O N S -->
    <list name="inquiry_fn">
    <!-- Inquiry functions for any type -->
      <item> associated </item>
      <item> present </item>
      <item> kind </item>
    <!-- String-handling inquiry function -->
      <item> len </item>
    <!-- Numeric inquiry functions -->
      <item> digits </item>
      <item> epsilon </item>
      <item> huge </item>
      <item> maxexponent </item>
      <item> minexponent </item>
      <item> precision </item>
      <item> radix </item>
      <item> range </item>
      <item> tiny </item>
    <!-- Bit inquiry function -->
      <item> bit_size </item>
    <!-- Array inquiry functions -->
      <item> allocated </item>
      <item> lbound </item>
      <item> ubound </item>
      <item> shape </item>
      <item> size </item>
    </list>

<!-- T R A N S F O R M A T I O N A L    F U N C T I O N S -->
    <list name="transform_fn">
    <!-- String-handling transformational functions -->
      <item> repeat </item>
      <item> trim </item>
    <!-- Transformational functions for kind values -->
      <item> selected_int_kind </item>
      <item> selected_real_kind </item>
    <!-- Transfer function -->
      <item> transfer </item>
    <!-- Vector and matrix multiplication functions -->
      <item> dot_product </item>
      <item> matmul </item>
    <!-- Transformational functions that reduce arrays -->
      <item> all </item>
      <item> any </item>
      <item> count </item>
      <item> maxval </item>
      <item> minval </item>
      <item> product </item>
      <item> sum </item>
    <!-- Packing and unpacking arrays -->
      <item> pack </item>
      <item> unpack </item>
    <!-- Transformational function for reshaping an array -->
      <item> reshape </item>
    <!-- Transformational function for replication -->
      <item> spread </item>
    <!-- Array shifting functions -->
      <item> cshift </item>
      <item> eoshift </item>
    <!-- Matrix transpose -->
      <item> transpose </item>
    <!-- Transformational functions for geometric location -->
      <item> maxloc </item>
      <item> minloc </item>
    </list>

<!-- N O N    E L E M E N T A L    S U B R O U T I N E S -->
    <list name="non_elem_subr">
    <!-- Real time clock -->
      <item> date_and_time </item>
      <item> system_clock </item>
    <!-- Random numbers -->
      <item> random_number </item>
      <item> random_seed </item>
    </list>

<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
<!-- *                           C O N T E X T S                         *  -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
    <contexts>
      <context attribute="Normal Text" lineEndContext="#stay" name="default" >
<!--         <IncludeRules context="begin_node_folders" /> -->
	<IncludeRules context="find_nodes" />
	
        <IncludeRules context="find_multi_comments" />
	<IncludeRules context="find_call_nodes" />
        <IncludeRules context="find_strings" />
        <IncludeRules context="find_decls" />
        <IncludeRules context="find_intrinsics" />
        <IncludeRules context="find_io_stmnts" />
        <IncludeRules context="find_op_and_log" />
        <IncludeRules context="find_numbers" />
        <IncludeRules context="find_preprocessor" />
        <IncludeRules context="find_comments" />
	<IncludeRules context="find_symbols" />
        <IncludeRules context="find_begin_stmnts" />
        <IncludeRules context="find_end_stmnts" />
        <IncludeRules context="find_mid_stmnts" />
      </context>
<!--************************END OF THE MAIN CONTEXT*************************-->

<!-- begin bakl -->

<!-- This context highlights comments lines -->
	<context name="begin_node_folders" attribute="Normal Text" lineEndContext="#stay">
<!-- 	  <StringDetect attribute="Keyword" context="#stay" String="subroutine"  beginRegion="trf_node" /> -->
	  <RegExpr attribute="Keyword" context="#stay" String="\b(subroutine|function|program)\b" insensitive="TRUE" beginRegion="trf_node"/>
       
<!-- 	  <RegExpr  attribute="call nodes" context="#stay" String="%&parsername;:" beginRegion="trf_node" />  -->
	</context>

	<context attribute="Normal Text" lineEndContext="#stay" name="find_multi_comments">
		<DetectSpaces />
		<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
	</context>
	<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
		<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
	</context>

	<!-- This context highlights call nodes lines -->
	<context attribute="Normal Text" lineEndContext="#stay" name="find_call_nodes">
		<DetectSpaces />
		<RegExpr attribute="call nodes" context="CallerNodes2" String="(&lt;\*)" />
	</context>
	<context attribute="call nodes" lineEndContext="#stay" name="CallerNodes2">
		<DetectSpaces />
		<RegExpr attribute="call nodes" context="#pop" String="(\*&gt;.?)" />
	</context>

	<!-- This context highlights nodes  -->
	<context name="find_nodes" attribute="Normal Text" lineEndContext="#stay">
  		<RegExpr  attribute="call nodes" context="Nodes2" String="^%&parsername;:.*$"   beginRegion="trf_node"    /> 
	</context>
	<context name="Nodes2" attribute="Normal Text">
		<StringDetect attribute="call nodes" context="#pop#pop" String="--%"    endRegion="trf_node" column="0" />		
		
		<IncludeRules context="find_multi_comments" />
		<IncludeRules context="find_call_nodes" />
		<IncludeRules context="find_strings" />
		<IncludeRules context="find_decls" />
		<IncludeRules context="find_intrinsics" />
		<IncludeRules context="find_io_stmnts" />
		<IncludeRules context="find_op_and_log" />
		<IncludeRules context="find_numbers" />
		<IncludeRules context="find_preprocessor" />
		<IncludeRules context="find_comments" />
		<IncludeRules context="find_symbols" />
		<IncludeRules context="find_end_stmnts" />
		<IncludeRules context="find_begin_stmnts" />

		
		
		<RegExpr  attribute="call nodes" context="#pop#pop" String="%&parsername;:"    endRegion="trf_node"  lookAhead="true"  /> 
	</context>
<!-- end bakl -->

<!-- This context highlights preprocessor lines -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_preprocessor">
        <RegExpr attribute="Preprocessor" context="#stay" String="(#|cDEC\$|CDEC\$).*$" column="0"/>
      </context>

<!-- This context highlights operators and the logical values .true. .false. -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_op_and_log">
        <RegExpr attribute="Logical" context="#stay" String="\.(true|false)\." insensitive="TRUE"/>
        <RegExpr attribute="Operator" context="#stay" String="\.[A-Za-z]+\."/>
        <RegExpr attribute="Operator" context="#stay" String="(==|/=|&lt;|&lt;=|&gt;|&gt;=)"/>
      </context>

<!-- This context highlights comments -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_comments">
        <RegExpr attribute="Comment" context="#stay" String="[cC\*].*$" column="0"/>
        <RegExpr attribute="Comment" context="#stay" String="!.*$"/>
        <RegExpr attribute="Comment" context="#stay" String="--.*$"/>
        <Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
      </context>
      <context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
        <DetectSpaces />
        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
        <IncludeRules context="##Alerts" />
        <DetectIdentifier />
      </context>

<!-- This context highlights symbols -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_symbols">
        <Detect2Chars attribute="Keyword" context="#stay" char="*" char1="*"/>
        <Detect2Chars attribute="Keyword" context="#stay" char="(" char1="/"/>
        <Detect2Chars attribute="Keyword" context="#stay" char="/" char1=")"/>
        <AnyChar attribute="Keyword" context="#stay" String="&amp;+-*/=?[]^{|}~"/>
        <AnyChar attribute="Symbol" context="#stay" String="(),"/>
      </context>

<!-- This context highlights items inside the parentesis of a function -->
      <context attribute="Normal Text" lineEndContext="#stay" name="inside_func_paren">
        <DetectChar attribute="Normal Text" context="inside_func_paren" char="("/>
        <DetectChar attribute="Normal Text" context="#pop" char=")"/>
	<IncludeRules context="find_multi_comments" />
	<IncludeRules context="find_call_nodes" />
	<IncludeRules context="find_numbers" />
        <IncludeRules context="find_strings" />
        <IncludeRules context="find_intrinsics" />
        <IncludeRules context="find_numbers" />
      </context>

<!-- The following two contexts match input/output statements -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_io_stmnts">
        <RegExpr attribute="IO Function" context="find_io_paren" String="\b(read|write|backspace|rewind|end\s*file|close)\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="IO Function" context="find_io_paren" String="\bopen\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="IO Function" context="find_io_paren" String="\binquire\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="IO Function" context="format_stmnt" String="\bformat\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="IO Function" context="#stay" String="\bend\s*file\b" insensitive="TRUE"/>
        <keyword attribute="IO Function" context="#stay" String="io_functions"/>
      </context>
<!-- This context matches parenthesis for the read, write, ... statements -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_io_paren">
        <DetectChar attribute="IO Function" context="#stay" char="*"/>
        <DetectChar attribute="Normal Text" context="inside_func_paren" char="("/>
        <DetectChar attribute="IO Function" context="#pop" char=")"/>
        <keyword attribute="IO Function"  context="#stay" String="io_keywords"/>
        <keyword attribute="IO Function"  context="#stay" String="inquire_keywords"/>
        <keyword attribute="IO Function"  context="#stay" String="open_keywords"/>
        <IncludeRules context="find_strings" />
        <IncludeRules context="find_intrinsics" />
        <IncludeRules context="find_numbers" />
        <IncludeRules context="find_symbols" />
      </context>
<!-- This context highlights the text inside the parenthesis of fortran statement -->
      <context attribute="Normal Text" lineEndContext="#stay" name="format_stmnt">
        <DetectChar attribute="IO Function" context="format_stmnt" char="("/>
        <DetectChar attribute="IO Function" context="#pop" char=")"/>
        <RegExpr attribute="IO Function" context="#stay" String="[0-9]*/" insensitive="TRUE"/>
        <AnyChar attribute="IO Function" context="#stay" String=":"/>
        <IncludeRules context="find_strings" />
        <IncludeRules context="find_symbols" />
      </context>

<!-- The following context matches the begin of program units -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_begin_stmnts">
        <RegExpr attribute="Keyword" context="#stay" String="\bmodule\s+procedure\b" insensitive="TRUE"/>
        <RegExpr attribute="Keyword" context="#stay" String="\b(subroutine|function|block\s*data)\b" insensitive="TRUE" beginRegion="Routine"/>
        <RegExpr attribute="Keyword" context="#stay" String="\b(program|module|block\s*data)\b" insensitive="TRUE" beginRegion="Routine"/>
        <RegExpr attribute="Keyword" context="#stay" String="\b(then|do)\b" insensitive="TRUE" beginRegion="Block"/>
      </context>
<!-- The following context matches the end of program units -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_end_stmnts">
        <RegExpr attribute="Keyword" context="#stay" String="\bend\s*(subroutine|function|block\s*data)\b" insensitive="TRUE" endRegion="Routine"/>
        <RegExpr attribute="Keyword" context="#stay" String="\bend\s*(program|module)\b" insensitive="TRUE" endRegion="Routine"/>
        <RegExpr attribute="Keyword" context="#stay" String="\bend\s*(do|if)\b" insensitive="TRUE" endRegion="Block"/>
        <RegExpr attribute="Keyword" context="#stay" String="\bend\s*(select|where|forall|interface)\b" insensitive="TRUE"/>
        <RegExpr attribute="Keyword" context="#stay" String="\belse\s*if\b" insensitive="TRUE" endRegion="Block"/>
        <RegExpr attribute="Keyword" context="#stay" String="\bend\b" insensitive="TRUE" endRegion="Routine"/>
      </context>
<!-- The following context matches the mid of program units -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_mid_stmnts">
        <RegExpr attribute="Keyword" context="#stay" String="\belse\b" insensitive="TRUE" endRegion="Block" beginRegion="Block"/>
        <RegExpr attribute="Keyword" context="#stay" String="\bcontains\b" insensitive="TRUE" endRegion="Routine" beginRegion="Routine"/>
      </context>

<!-- The following two contexts match declarations -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_decls">
        <RegExpr attribute="Data Type" context="#stay" String="\binteger[\*]\d{1,2}" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="\breal[\*]\d{1,2}" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="\bcomplex[\*]\d{1,2}" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="\bend\s*type\b" insensitive="TRUE"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <RegExpr attribute="Data Type" context="#stay" String="^\s*data\b" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="find_paren" String="^\s*real\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="^\s*real(?![\w\*])" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="\bcharacter[*][0-9]+\b" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="find_paren" String="\b(type|integer|complex|character|logical|intent|dimension)\b\s*[(]" insensitive="TRUE"/>
        <RegExpr attribute="Data Type" context="#stay" String="\b(type|integer|complex|character|logical|intent|dimension)\b" insensitive="TRUE"/>
        <Detect2Chars attribute="Data Type" context="#stay" char=":" char1=":"/>
      </context>
<!-- This context matches parenthesis in data type declarations, such as in 'real(...)'-->
      <context attribute="Data Type" lineEndContext="#pop" name="find_paren">
        <DetectChar attribute="Data Type" context="find_paren" char="("/>
        <DetectChar attribute="Data Type" context="#pop" char=")"/>
      </context>

<!-- The following context matches intrinsic procedures -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_intrinsics">
        <keyword attribute="Keyword" context="#stay" String="keywords"/>
      <!-- INTRINSIC PROCEDURES -->
        <keyword attribute="Elemental Procedure"       context="#stay" String="elemental_procs"/>
        <keyword attribute="Inquiry Function"          context="#stay" String="inquiry_fn"/>
        <keyword attribute="Transformational Function" context="#stay" String="transform_fn"/>
        <keyword attribute="Non elemental subroutine"  context="#stay" String="non_elem_subr"/>
      </context>

<!-- The following context matches integer and real numbers -->
      <context attribute="Normal Text" lineEndContext="#stay" name="find_numbers">
        <!-- Floating-point numbers with optional kind -->
        <RegExpr attribute="Float" context="#stay" String="[0-9]*\.[0-9]+([de][+-]?[0-9]+)?([_]([0-9]+|[a-z][\w_]*))?" insensitive="TRUE"/>
        <RegExpr attribute="Float" context="#stay" String="\b[0-9]+\.[0-9]*([de][+-]?[0-9]+)?([_]([0-9]+|[a-z][\w_]*))?(?![a-z])" insensitive="TRUE"/>
        <RegExpr attribute="Float" context="#stay" String="\b[0-9]+[de][+-]?[0-9]+([_]([0-9]+|[a-z][\w_]*))?" insensitive="TRUE"/>
        <!-- Integers with optional kind specifier -->
        <RegExpr attribute="Decimal" context="#stay" String="\b[0-9]+([_]([0-9]+|[a-zA-Z][\w_]*))?"/>
        <!-- Integers in binary, octal and hexadecimal notations -->
        <RegExpr attribute="Decimal" context="#stay" String="\b[bozx]([&apos;][0-9a-f]+[&apos;]|[&quot;][0-9a-f]+[&quot;])" insensitive="TRUE"/>
      </context>

<!-- The following four contexts implement the complex string multi-line declarations -->
      <!-- Matches STRINGS (there are 2 types of strings: '...' and "...") -->
      <context attribute="String" lineEndContext="#stay" name="find_strings">
        <DetectChar attribute="String" context="string_1" char="&apos;"/>
        <DetectChar attribute="String" context="string_2" char="&quot;"/>
      </context>

      <context attribute="String" lineEndContext="#stay" name="string_1" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="String" context="#pop" String="[^&apos;]*&apos;"/>
        <RegExpr attribute="Keyword" context="end_of_string" String="&amp;\s*$"/>
        <RegExpr attribute="String" context="end_of_string" String=".*(?=&amp;\s*$)"/>
      </context>

      <context attribute="String" lineEndContext="#stay" name="string_2" fallthrough="true" fallthroughContext="#pop">
        <RegExpr attribute="String" context="#pop" String="[^&quot;]*&quot;"/>
        <RegExpr attribute="Keyword" context="end_of_string" String="&amp;\s*$"/>
        <RegExpr attribute="String" context="end_of_string" String=".*(?=&amp;\s*$)"/>
      </context>

      <context attribute="String" lineEndContext="#stay" name="end_of_string" fallthrough="true" fallthroughContext="#pop#pop">
        <DetectSpaces />
        <RegExpr attribute="Keyword" context="#stay" String="&amp;\s*$"/>
        <DetectChar attribute="Keyword" context="#pop" char="&amp;" firstNonSpace="true"/>
        <RegExpr attribute="Comment" context="#stay" String="(!.*)?$" firstNonSpace="true"/>
      </context>
    </contexts>

<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
<!-- *             S T Y L E   I T E M   D E F I N I T I O N S           *  -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Keyword" defStyleNum="dsKeyword"/>
      <itemData name="Data Type" defStyleNum="dsDataType"/>
      <itemData name="Decimal" defStyleNum="dsDecVal"/>
      <itemData name="Float" defStyleNum="dsFloat"/>
      <itemData name="String" defStyleNum="dsString"/>
      <itemData name="Comment" defStyleNum="dsComment"/>
      <itemData name="Symbol" defStyleNum="dsNormal"/>
      <itemData name="Preprocessor" defStyleNum="dsOthers"/>
      <itemData name="Operator" defStyleNum="dsKeyword" color="#008000" selColor="#ff00ff" bold="1" italic="0"/>
      <itemData name="Logical" defStyleNum="dsOthers" color="#800080" selColor="#ffa0a0" bold="1" italic="0"/>
      <itemData name="IO Function" defStyleNum="dsFunction" color="#006060" selColor="#ffffff" bold="0" italic="0"/>
      <itemData name="Elemental Procedure" defStyleNum="dsKeyword" color="#600060" selColor="#ffa0ff" bold="1" italic="0"/>
      <itemData name="Inquiry Function" defStyleNum="dsFunction" color="#000060" selColor="#a0a0ff" bold="1" italic="1"/>
      <itemData name="Transformational Function" defStyleNum="dsFunction" color="#600060" selColor="#ffa0ff" bold="1" italic="0"/>
      <itemData name="Non elemental subroutine" defStyleNum="dsKeyword" color="#600060" selColor="#ffa0ff" bold="1" italic="0"/>
      <itemData name="call nodes" defStyleNum="dsKeyword" color="#600060" selColor="#ffa0ff" bold="0" italic="1"/>
    </itemDatas>
  </highlighting>
  <general>
    <comments>
<!--       <comment name="singleLine" start="c"/> -->
<!--       <comment name="singleLine" start="!"/> -->
      <comment name="singleLine" start="--!"/>
      <comment name="multiLine" start="/*" end="*/" region="Comment"/>
    </comments>
    <keywords casesensitive="0"/>
  </general>
</language>
